package Text;


class Anamial{
    private String name;
    private int age;
    Anamial(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("Anamial的构造方法");
    }
    public void sleep(){
        System.out.println(this.name+" 正在吃饭");
    }
    static {
        System.out.println("Animal的静态代码块");
    }
    {
        System.out.println("Animal的实例代码块");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Cat extends Anamial{

    static {
        System.out.println("Cat的静态代码块");
    }
    {
        System.out.println("Cat的实例代码块");
    }
    Cat (String name,int age){
        super(name,age);
        System.out.println("Cat的构造方法");
    }
    public void mew(){
        System.out.println(this.getName()+" mew mew 叫");
    }
}

public class TextDemo2 {
    public static void main(String[] args) {
    }
    public static void main2(String[] args) {
        Cat cat = new Cat("咪咪",6);
        System.out.println("++++++++++++++++++++");
        Cat cat1 = new Cat("咪咪咪",8);
    }
    public static void main1(String[] args) {
        Cat cat = new Cat("咪咪",6);
        System.out.println("++++++++++++++++++++");
        Cat cat1 = new Cat("咪咪咪",8);
    }
}


